package hot_100;

public class 盛最多水的容器 {
    public static void main(String[] args) {

    }

    public int maxArea(int[] height) {
        int r = height.length - 1;
        int l = 0;
        int ans = 0;
        while (r > l) {
            ans = Math.max((r - l + 1) * Math.min(height[l], height[r]), ans);
            if (height[l] <= height[r])
                l++;
            else
                r--;
        }
        return ans;
    }
}
